package com.dhcc.dubbo.service.impl;

import java.util.ArrayList;
import java.util.List;

import org.apache.tomcat.util.security.MD5Encoder;
import org.springframework.stereotype.Component;

import com.alibaba.dubbo.config.annotation.Service;
import com.dhcc.dubbo.bean.User;
import com.dhcc.dubbo.service.UserService;

@Service(version = "1.0.0") // dubbo的service注解，不具备spring的@service注解的功能
@Component
public class UserServiceImpl implements UserService {

    public List<User> getAllUsers(int sum) {
        List<User> users = new ArrayList<User>();
        for (int i = 0; i < sum; i++) {
            User user = new User("usernname" + i, "password" + i);
            users.add(user);
        }

        return users;
    }

    public User getUserByUserName(String username) {
        return new User(username, username);
    }

	@Override
	public User getUserByName(String name) {
		return new User("name:"+name, "pass:"+name);
	}
}